////////////////////////////////////////////////////////////////////////////
//
//  Crytek Engine Header File.
//  Copyright (C), Crytek Studios, 2010.
// -------------------------------------------------------------------------
//  File name:   AVCompressionAudioTable.h
//  Version:     v1.00
//  Created:     09/04/2010 by John Stewart.
//  Compilers:   
//  Description: Audio Compression Data tables.
// -------------------------------------------------------------------------
//  History:
//
////////////////////////////////////////////////////////////////////////////




// MPEG-1 audio windowing coeffs ISO 11172-3 table 3-C.1
const float AudioWindowCoeffs[512] = {
	0.000000000f , -0.000015259f , -0.000015259f , -0.000015259f, -0.000015259f , -0.000015259f , -0.000015259f , -0.000030518f, 
	-0.000030518f , -0.000030518f , -0.000030518f , -0.000045776f, -0.000045776f , -0.000061035f , -0.000061035f , -0.000076294f, 
	-0.000076294f , -0.000091553f , -0.000106812f , -0.000106812f, -0.000122070f , -0.000137329f , -0.000152588f , -0.000167847f, 
	-0.000198364f , -0.000213623f , -0.000244141f , -0.000259399f, -0.000289917f , -0.000320435f , -0.000366211f , -0.000396729f, 
	-0.000442505f , -0.000473022f , -0.000534058f , -0.000579834f, -0.000625610f , -0.000686646f , -0.000747681f , -0.000808716f, 
	-0.000885010f , -0.000961304f , -0.001037598f , -0.001113892f, -0.001205444f , -0.001296997f , -0.001388550f , -0.001480103f, 
	-0.001586914f , -0.001693726f , -0.001785278f , -0.001907349f, -0.002014160f , -0.002120972f , -0.002243042f , -0.002349854f, 
	-0.002456665f , -0.002578735f , -0.002685547f , -0.002792358f, -0.002899170f , -0.002990723f , -0.003082275f , -0.003173828f, 
	0.003250122f ,  0.003326416f ,  0.003387451f ,  0.003433228f,  0.003463745f ,  0.003479004f ,  0.003479004f ,  0.003463745f, 
	0.003417969f ,  0.003372192f ,  0.003280640f ,  0.003173828f,  0.003051758f ,  0.002883911f ,  0.002700806f ,  0.002487183f, 
	0.002227783f ,  0.001937866f ,  0.001617432f ,  0.001266479f,  0.000869751f ,  0.000442505f , -0.000030518f , -0.000549316f, 
	-0.001098633f , -0.001693726f , -0.002334595f , -0.003005981f, -0.003723145f , -0.004486084f , -0.005294800f , -0.006118774f, 
	-0.007003784f , -0.007919312f , -0.008865356f , -0.009841919f, -0.010848999f , -0.011886597f , -0.012939453f , -0.014022827f, 
	-0.015121460f , -0.016235352f , -0.017349243f , -0.018463135f, -0.019577026f , -0.020690918f , -0.021789551f , -0.022857666f, 
	-0.023910522f , -0.024932861f , -0.025909424f , -0.026840210f, -0.027725220f , -0.028533936f , -0.029281616f , -0.029937744f, 
	-0.030532837f , -0.031005859f , -0.031387329f , -0.031661987f, -0.031814575f , -0.031845093f , -0.031738281f , -0.031478882f, 
	0.031082153f ,  0.030517578f ,  0.029785156f ,  0.028884888f,  0.027801514f ,  0.026535034f ,  0.025085449f ,  0.023422241f, 
	0.021575928f ,  0.019531250f ,  0.017257690f ,  0.014801025f,  0.012115479f ,  0.009231567f ,  0.006134033f ,  0.002822876f, 
	-0.000686646f , -0.004394531f , -0.008316040f , -0.012420654f, -0.016708374f , -0.021179199f , -0.025817871f , -0.030609131f, 
	-0.035552979f , -0.040634155f , -0.045837402f , -0.051132202f, -0.056533813f , -0.061996460f , -0.067520142f , -0.073059082f, 
	-0.078628540f , -0.084182739f , -0.089706421f , -0.095169067f, -0.100540161f , -0.105819702f , -0.110946655f , -0.115921021f, 
	-0.120697021f , -0.125259399f , -0.129562378f , -0.133590698f, -0.137298584f , -0.140670776f , -0.143676758f , -0.146255493f, 
	-0.148422241f , -0.150115967f , -0.151306152f , -0.151962280f, -0.152069092f , -0.151596069f , -0.150497437f , -0.148773193f, 
	-0.146362305f , -0.143264771f , -0.139450073f , -0.134887695f, -0.129577637f , -0.123474121f , -0.116577148f , -0.108856201f, 
	0.100311279f ,  0.090927124f ,  0.080688477f ,  0.069595337f,  0.057617187f ,  0.044784546f ,  0.031082153f ,  0.016510010f, 
	0.001068115f , -0.015228271f , -0.032379150f , -0.050354004f, -0.069168091f , -0.088775635f , -0.109161377f , -0.130310059f, 
	-0.152206421f , -0.174789429f , -0.198059082f , -0.221984863f, -0.246505737f , -0.271591187f , -0.297210693f , -0.323318481f, 
	-0.349868774f , -0.376800537f , -0.404083252f , -0.431655884f, -0.459472656f , -0.487472534f , -0.515609741f , -0.543823242f, 
	-0.572036743f , -0.600219727f , -0.628295898f , -0.656219482f, -0.683914185f , -0.711318970f , -0.738372803f , -0.765029907f, 
	-0.791213989f , -0.816864014f , -0.841949463f , -0.866363525f, -0.890090942f , -0.913055420f , -0.935195923f , -0.956481934f, 
	-0.976852417f , -0.996246338f , -1.014617920f , -1.031936646f, -1.048156738f , -1.063217163f , -1.077117920f , -1.089782715f, 
	-1.101211548f , -1.111373901f , -1.120223999f , -1.127746582f, -1.133926392f , -1.138763428f , -1.142211914f , -1.144287109f, 
	1.144989014f ,  1.144287109f ,  1.142211914f ,  1.138763428f,  1.133926392f ,  1.127746582f ,  1.120223999f ,  1.111373901f, 
	1.101211548f ,  1.089782715f ,  1.077117920f ,  1.063217163f,  1.048156738f ,  1.031936646f ,  1.014617920f ,  0.996246338f, 
	0.976852417f ,  0.956481934f ,  0.935195923f ,  0.913055420f,  0.890090942f ,  0.866363525f ,  0.841949463f ,  0.816864014f, 
	0.791213989f ,  0.765029907f ,  0.738372803f ,  0.711318970f,  0.683914185f ,  0.656219482f ,  0.628295898f ,  0.600219727f, 
	0.572036743f ,  0.543823242f ,  0.515609741f ,  0.487472534f,  0.459472656f ,  0.431655884f ,  0.404083252f ,  0.376800537f, 
	0.349868774f ,  0.323318481f ,  0.297210693f ,  0.271591187f,  0.246505737f ,  0.221984863f ,  0.198059082f ,  0.174789429f, 
	0.152206421f ,  0.130310059f ,  0.109161377f ,  0.088775635f,  0.069168091f ,  0.050354004f ,  0.032379150f ,  0.015228271f, 
	-0.001068115f , -0.016510010f , -0.031082153f , -0.044784546f, -0.057617187f , -0.069595337f , -0.080688477f , -0.090927124f, 
	0.100311279f ,  0.108856201f ,  0.116577148f ,  0.123474121f,  0.129577637f ,  0.134887695f ,  0.139450073f ,  0.143264771f, 
	0.146362305f ,  0.148773193f ,  0.150497437f ,  0.151596069f,  0.152069092f ,  0.151962280f ,  0.151306152f ,  0.150115967f, 
	0.148422241f ,  0.146255493f ,  0.143676758f ,  0.140670776f,  0.137298584f ,  0.133590698f ,  0.129562378f ,  0.125259399f, 
	0.120697021f ,  0.115921021f ,  0.110946655f ,  0.105819702f,  0.100540161f ,  0.095169067f ,  0.089706421f ,  0.084182739f,
	0.078628540f ,  0.073059082f ,  0.067520142f ,  0.061996460f,  0.056533813f ,  0.051132202f ,  0.045837402f ,  0.040634155f, 
	0.035552979f ,  0.030609131f ,  0.025817871f ,  0.021179199f,  0.016708374f ,  0.012420654f ,  0.008316040f ,  0.004394531f, 
	0.000686646f , -0.002822876f , -0.006134033f , -0.009231567f, -0.012115479f , -0.014801025f , -0.017257690f , -0.019531250f, 
	-0.021575928f , -0.023422241f , -0.025085449f , -0.026535034f, -0.027801514f , -0.028884888f , -0.029785156f , -0.030517578f, 
	0.031082153f ,  0.031478882f ,  0.031738281f ,  0.031845093f,  0.031814575f ,  0.031661987f ,  0.031387329f ,  0.031005859f, 
	0.030532837f ,  0.029937744f ,  0.029281616f ,  0.028533936f,  0.027725220f ,  0.026840210f ,  0.025909424f ,  0.024932861f, 
	0.023910522f ,  0.022857666f ,  0.021789551f ,  0.020690918f,  0.019577026f ,  0.018463135f ,  0.017349243f ,  0.016235352f, 
	0.015121460f ,  0.014022827f ,  0.012939453f ,  0.011886597f,  0.010848999f ,  0.009841919f ,  0.008865356f ,  0.007919312f, 
	0.007003784f ,  0.006118774f ,  0.005294800f ,  0.004486084f,  0.003723145f ,  0.003005981f ,  0.002334595f ,  0.001693726f, 
	0.001098633f ,  0.000549316f ,  0.000030518f , -0.000442505f, -0.000869751f , -0.001266479f , -0.001617432f , -0.001937866f, 
	-0.002227783f , -0.002487183f , -0.002700806f , -0.002883911f, -0.003051758f , -0.003173828f , -0.003280640f , -0.003372192f, 
	-0.003417969f , -0.003463745f , -0.003479004f , -0.003479004f, -0.003463745f , -0.003433228f , -0.003387451f , -0.003326416f,
	0.003250122f ,  0.003173828f ,  0.003082275f ,  0.002990723f,  0.002899170f ,  0.002792358f ,  0.002685547f ,  0.002578735f, 
	0.002456665f ,  0.002349854f ,  0.002243042f ,  0.002120972f,  0.002014160f ,  0.001907349f ,  0.001785278f ,  0.001693726f, 
	0.001586914f ,  0.001480103f ,  0.001388550f ,  0.001296997f,  0.001205444f ,  0.001113892f ,  0.001037598f ,  0.000961304f, 
	0.000885010f ,  0.000808716f ,  0.000747681f ,  0.000686646f,  0.000625610f ,  0.000579834f ,  0.000534058f ,  0.000473022f, 
	0.000442505f ,  0.000396729f ,  0.000366211f ,  0.000320435f,  0.000289917f ,  0.000259399f ,  0.000244141f ,  0.000213623f, 
	0.000198364f ,  0.000167847f ,  0.000152588f ,  0.000137329f,  0.000122070f ,  0.000106812f ,  0.000106812f ,  0.000091553f};



	// Fixed signal to mask ratio used instead of a more complex psycho acoustic model
	const int AudioFixedSMR[32] =  {300, 170, 160, 100, 30, 120, 80, 25,50, 50, 60, 60, 50, 60, 100, 60,-40, -100,
										-210, -300, -420, -550, -680, -750,-750, -750, -750, -750, -910, -1070, -1100, -1080};


	// Max number of bits and bits used to encode quant value
	// derived from ISO 11172-3 tables 3-B.2
	const unsigned char MaxBitsSubband[32] = {15,15,15,15,15,15,15,15,15,15,15,7,7,7,7,7,7,7,7,7,7,7,7,3,3,3,3,3,3,3,3,3};
	const unsigned char EncodedBitsSubband[32] = {4,4,4,4,4,4,4,4,4,4,4,3,3,3,3,3,3,3,3,3,3,3,3,2,2,2,2,2,2,2,2,2};



	// Indexes for quantization bit values for the subbands
	// derived from ISO 11172-3 tables 3-B.2
	const unsigned char AudioBitAllocTable[BITALLOCTABLEWIDTH*32] = {
			0,  2,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15, 16,
			0,  2,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15, 16,
			0,  2,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15, 16,
			0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 16,
			0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 16,
			0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 16,
			0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 16,
			0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 16,
			0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 16,
			0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 16,
			0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 16,
			0,  1,  2,  3,  4,  5, 16,  0,  0,  0,  0,  0,  0,  0,  0,
			0,  1,  2,  3,  4,  5, 16,  0,  0,  0,  0,  0,  0,  0,  0,
			0,  1,  2,  3,  4,  5, 16,  0,  0,  0,  0,  0,  0,  0,  0,
			0,  1,  2,  3,  4,  5, 16,  0,  0,  0,  0,  0,  0,  0,  0,
			0,  1,  2,  3,  4,  5, 16,  0,  0,  0,  0,  0,  0,  0,  0,
			0,  1,  2,  3,  4,  5, 16,  0,  0,  0,  0,  0,  0,  0,  0,
			0,  1,  2,  3,  4,  5, 16,  0,  0,  0,  0,  0,  0,  0,  0,
			0,  1,  2,  3,  4,  5, 16,  0,  0,  0,  0,  0,  0,  0,  0,
			0,  1,  2,  3,  4,  5, 16,  0,  0,  0,  0,  0,  0,  0,  0,
			0,  1,  2,  3,  4,  5, 16,  0,  0,  0,  0,  0,  0,  0,  0,
			0,  1,  2,  3,  4,  5, 16,  0,  0,  0,  0,  0,  0,  0,  0,
			0,  1,  2,  3,  4,  5, 16,  0,  0,  0,  0,  0,  0,  0,  0,
			0,  1, 16,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
			0,  1, 16,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
			0,  1, 16,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
			0,  1, 16,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
			0,  1, 16,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
			0,  1, 16,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
			0,  1, 16,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
			0,  1, 16,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
			0,  1, 16,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0};

		// Step size and quantization bits for various quantization indices
		// derived from ISO 11172-3 tables 3-B.4
		const int AudioQuantSteps[17] = {  3,  5,  7,   9, 15,  31, 63, 127, 255, 511, 1023, 2047, 4095, 8191, 16383, 32767, 65535};
		const int AudioQuantBits[17] = {  -5, -7,  3, -10,  4,   5,  6,   7,   8,   9,   10,   11,   12,   13,    14,    15,    16};

		// Scale code values and patterns
		// derived from ISO 11172-3 tables 3-C.4
		const	int AcodeVal[25] = {SEND3,SEND2B,SEND2B,SEND2B,SEND3,SEND2A,SEND1,SEND1,SEND1,SEND2A,SEND1,SEND1,SEND1,SEND1,SEND2A,SEND1,SEND1,SEND1,SEND1,SEND3,SEND3,SEND2B,SEND2B,SEND2B,SEND3};
		const 	int ApatternVal[25] = {0,1,1,2,0,3,4,4,5,3,4,4,4,6,3,7,7,7,6,0,0,1,1,2,0};
		const	int AclassVal[7] = {0,1,1,2,3,3,4};

		// Quantization bits for a subband for a particular quant index
		// derived from ISO 11172-3 tables 3-B.4
		const int AudioTotalQuantBits[17] = {60,84,108,120,144,180,216,252,288,324,360,396,432,468,504,540,576};

		// SNR for a particular quant index
		// derived from ISO 11172-3 tables 3-C.5
		const unsigned short AudioQuantSNR[17] = {70, 110, 160, 208,253, 316, 378, 439,499, 559, 620, 680,740, 800, 861, 920,980};

		// Scalefactor derived from ISO 11172-3 table 3-B.1
		const int AudioScalingTable[64] = { 2097152, 1664510, 1321122, 1048576, 832255, 660561, 524288, 416127, 330280, 262144, 208063, 165140, 131072, 104031, 82570, 65536,
			52015, 41285, 32768, 26007, 20642, 16384, 13003, 10321, 8192, 6501, 5160, 4096, 3250, 2580, 2048, 1625, 1290, 1024, 812, 645, 512,
			406, 322, 256, 203, 161, 128, 101, 80, 64, 50, 40, 32, 25, 20, 16, 12, 10, 8, 6, 5, 4, 3, 2, 2, 1, 1, 1};


		// Quantization multipliers for the scalefactors
		// derived from ISO 11172-3 table 3-B.1
		const float AudioQuantInverseMult[64] = {	4.76837158e-7f, 6.00777184e-7f, 7.56931797e-7f, 9.53674316e-7f, 1.20155437e-6f,
				1.51386359e-6f, 1.90734863e-6f, 2.40310874e-6f,3.02772719e-6f, 3.81469727e-6f, 4.80621748e-6f, 6.05545438e-6f, 7.62939453e-6f,
				9.61243495e-6f, 1.21109088e-5f, 1.52587891e-5f,1.92248699e-5f, 2.42218175e-5f, 3.05175781e-5f, 3.84497398e-5f, 4.84436350e-5f,
				6.10351563e-5f, 7.68994796e-5f, 9.68872700e-5f,1.22070313e-4f, 1.53798959e-4f, 1.93774540e-4f, 2.44140625e-4f, 3.07597918e-4f,
				3.87549080e-4f, 4.88281250e-4f, 6.15195837e-4f,7.75098160e-4f, 9.76562500e-4f, 1.23039167e-3f, 1.55019632e-3f, 1.95312500e-3f,
				2.46078335e-3f, 3.10039264e-3f, 3.90625000e-3f,4.92156669e-3f, 6.20078528e-3f, 7.81250000e-3f, 9.84313339e-3f, 1.24015706e-2f,
				1.56250000e-2f, 1.96862668e-2f, 2.48031411e-2f,3.12500000e-2f, 3.93725336e-2f, 4.96062823e-2f, 6.25000000e-2f, 7.87450671e-2f,
				9.92125645e-2f, 1.25000000e-1f, 1.57490134e-1f,1.98425129e-1f, 2.50000000e-1f, 3.14980268e-1f, 3.96850258e-1f, 5.00000000e-1f,
				6.29960537e-1f, 7.93700516e-1f, 1.00000000e+0f}; 

